-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IDLE-180] 센터프로필 조회및 수정 API 연동 #22
Conversation
SVG형식의 이미지파일은 픽셀기반이 아닌 수학적 벡터를 사용하여 이미지를 랜더링한다. 따라서 Single scale모드로 사용해도 이미지의 해상도가 저하되지 않는다는 장점이 있다. 해당 방식을 적용한 이유는 화면 scale에(1x, 2x, 3x) 따라 이미지를 각각 할당해야하는 작업이 필요하지 않다는 것에서도 의의가 있다고 판단하여 사용하였다. UIImage는 랜더링 모드를 사용할 수 있다. 랜더링모드가 template일 경우 UIImageView의 tintColor프로퍼티로 전달한 색상값이 이미지 랜더링에 적용된다. 이미지가 단조로운 경우 여러 이미지를 사용할 필요없이 해당 방식을 사용하여 하나의 이미지를 범용적으로 쓸 수 있다는 장점이 있다.
let centerName: String? | ||
let officeNumber: String? | ||
let roadNameAddress: String? | ||
let lotNumberAddress: String? | ||
let detailedAddress: String? | ||
let longitude: String? | ||
let latitude: String? | ||
let introduce: String? | ||
let profileImageUrl: String? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@J0onYEong 이 값들이 모두 정말로 Optional인가요~~~?
적어도 몇개는 required로 갖고 있어야 할 값들로 보입니다. 파싱 오류 방지를 위해서 무조건 Optional로 가는건 좋지 않습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵! 저렇게 처리하고 랩핑을 벗길때 기본값을 고민했어야 했는데.. 앞으로는 요구사항을 좀더 명확히 인지해 보겠습니다!
.catch { error in | ||
if let httpExp = error as? HTTPResponseException { | ||
let newError = HTTPResponseException( | ||
status: httpExp.status, | ||
rawCode: "Err-001", | ||
timeStamp: httpExp.timeStamp | ||
) | ||
|
||
return .error(newError) | ||
} | ||
return .error(error) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앞으로 이 코드가 굉장히 반복될텐데 이 부분을 코드 복붙 말고 깔끔하게 처리할 수 있는 방법이 무엇이 있는지 고민해보시면 좋을 것 같습니다 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵! 명확하게 에러처리가 되어 있지 않은 부분들을 일관성 있게 처리할 수 있는 방법을 생각해봐야겠습니다. 말씀대로 코드가 지저분해질 것 같습니다.
@@ -48,6 +43,11 @@ public class IconStateButton: UIImageView { | |||
private func setAppearance() { | |||
|
|||
self.contentMode = .scaleAspectFit | |||
|
|||
// 이미지를 템플릿 모드로 변경 | |||
let templateImage = self.representImage.withRenderingMode(.alwaysTemplate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵~! 팁 감사합니다!!
변경된 부분
프로필 수정가능
프로필은 총 3가지 요소를 수정할 수 있습니다.
DefaultCenterProfileUseCase의 updateProfile함수를 통해 변경을 희망하는 요소들을 옵셔널로 전달받습니다.
이미지 업로드와 텍스트 업로드에 대한 처리가 독립적으로 동작하며, nil값을 전달받을 경우 해당하는 API를 요청하지 않습니다.
독립적으로 동작하지만 하나의 스트림을 통해서 발생하는 에러를 처리하기 위해 RxSwift의 zip오퍼레이터를 사용하였습니다.
updateTextResult, updateImageResult옵저버블은 각각 변경사항이 없는 경우 Void인스턴스를 명시적으로 방출하도록 설계하였습니다.